package router

import (
	"go-chat/controllers"
	"go-chat/middleware"

	"github.com/gin-gonic/gin"
)

func InitRouter() *gin.Engine {
	router := gin.Default()
	// 用户模块路由
	var userController controllers.UserController
	router.POST("/login", userController.Login)
	router.POST("/register", userController.Register)
	{ //用户模块路由
		user := router.Group("/user")
		user.Use(middleware.JWTAuthMiddleware())
		user.POST("/getInfo", userController.GetUserInfo)
		user.POST("/updateInfo", userController.UpdateUserInfo)
	}
	return router
}
